<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="x-ua-compatible" content="ie=edge">

  <title>{$SETTING.website_name}</title>

  {include file="../Common/cssjs"}
</head>

<body class="hold-transition sidebar-mini">
  <div class="wrapper">

      <table class="table table-bordered table-hover" width="100%">
                    
          <tr>
            <td colspan="7" align="center">
            <p class="mysearch_item">搜索：<input type="text" name="" id="searching"> </p>
            <p class="mysearch_item2"><input class="btn btn-primary" type="button" value="搜索" id="to_search"> <input type="button" class="btn btn-warning" value="重置" id="to_reset"></p>
            </td>
          </tr>
          
          </table>
          <div class="box-body table-responsive no-padding">
          <table class="table table-bordered table-hover mytable" width="100%">
          <tr>
            <td>名称</td>
            <td align="center">分类ID</td>
            <td align="center">路径</td>
          </tr>
          {foreach $category_arr as $key => $value}
          <tr>
            <td>
            {:str_repeat('&nbsp;',$value['lev']*4)}┖─&nbsp;<strong><a href="javascript:my_click(['{$value['catid']}','{:dhtmlspecialchars($value['catname'])}','{:dhtmlspecialchars($value['cat_pos'])}']);">{$value['catname']}</a></strong>
            </td>
          <td align="center">{$value['catid']}</td>
          <td align="center">{$value['cat_pos']|raw}</td>
          </tr>
          {/foreach}
          </table>    
    </div>


  </div>
  <script>
      $(document).ready(function(e) {
          $('#to_search').click(function(){
          var txt=$('#searching').val();
          if(txt===''){
            $('#to_reset').click();	
          }
          $('.mytable:eq(0) tr').each(function(index, element) {
                  var a=$(element).find('td').eq(0).text();
            if(a.indexOf(txt)>-1){
              $(element).show();	
            }else{
              $(element).hide();
            }
              });
          
        });
        $('#to_reset').click(function(){
          $('.mytable:eq(0) tr').show();
          $('#searching').val('');
        });
      });
      function my_click(arr){
        parent.<?php echo $callback;?>(arr);	
      }
      </script>
</body>

</html>